package com.dengyuanke.upms.logic.service.impl;

import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dengyuanke.upms.domain.entity.Role;
import com.dengyuanke.upms.domain.entity.RoleMenu;
import com.dengyuanke.upms.logic.mapper.RoleMapper;
import com.dengyuanke.upms.logic.service.IRoleMenuService;
import com.dengyuanke.upms.logic.service.IRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * <p>
 * 系统角色表 服务实现类
 * </p>
 *
 * @author dengyuanke
 * @since 2019-06-29
 */
@Service
public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements IRoleService {

    @Autowired
    private IRoleMenuService roleMenuService;

    @Override
    @Transactional(rollbackFor = Exception.class)
    public Boolean removeRoleById(Long id) {
        roleMenuService.remove(new LambdaUpdateWrapper<RoleMenu>().eq(RoleMenu::getRoleId, id));
        return this.removeById(id);
    }
}
